package com.zzx;

import java.util.Map;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;


/**
 * springboot 读取 properties 配置文件的内容，
   * 可以直接读取为 字段的值，使用（@value("") 配置，
   * 也可以把文件里面的内容全部读取为 map 集合，前台解析。
 * @author Administrator
 *
 */
@Configuration
@PropertySource("classpath:system.properties")
@ConfigurationProperties(prefix = "system")
public class SbootPropertiesUtil {
	
	@Value("${user}")
    private String name;
	
	@Value("${telnum}")
	private String telnum;
	
	@Value("${FTP_HOST_IP}")
	private String ftpId;

	private Map<String,String> map;
	
	public Map<String, String> getMap() {
		return map;
	}

	public void setMap(Map<String, String> map) {
		this.map = map;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTelnum() {
		return telnum;
	}

	public void setTelnum(String telnum) {
		this.telnum = telnum;
	}

	public String getFtpId() {
		return ftpId;
	}

	public void setFtpId(String ftpId) {
		this.ftpId = ftpId;
	}

	@Override
	public String toString() {
		String rtnStr = "name="+name+" ,telnum="+telnum+" ,ftpId="+ftpId;
		
		return rtnStr;
	}
	
	public static void main(String[] args) {
		SbootPropertiesUtil p = new SbootPropertiesUtil();
		System.err.println(p.getFtpId());		
	}

}
